import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/admin/login',
    method: 'post',
    params: {
      name: data.name,
      password: data.password
    }
  })
}

export function modifyPass(data) {
  return request({
    url: '/admin/modifyPass',
    method: 'post',
    params: {
      oldPass: data.oldPass,
      pass: data.pass
    }
  })
}

export function getInfo() {
  return request({
    url: '/admin/current-user',
    method: 'get'
  })
}

export function register(user) {
  return request({
    url: '/admin/register',
    method: 'post',
    params: user
  })
}

export function logout() {
  return request({
    url: '/vue-element-admin/user/logout',
    method: 'post'
  })
}
